home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Converters / Convert_PICT / Source / PICTFile.h < prev    next >
Text File  |  1995-06-12  |  5KB  |  185 lines

  1. /***********************************************************************\
  2. PICT file class for Convert PICT which converts graphics from PICT to eps formats.
  3. Copyright (C) 1993 David John Burrowes
  4.  
  5. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version.
  6.  
  7. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
  8.  
  9. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  10.  
  11. The author, David John Burrowes, can be reached at:
  12.     davidjohn@kira.net.netcom.com
  13.     David John Burrowes
  14.     1926 Ivy #10
  15.     San Mateo, CA 94403-1367
  16. \***********************************************************************/
  17.  
  18. /*
  19. ====================================================================
  20. This is the interface file for the PICTFile class.  Full documentation for this class can be found in the PICTFile.rtf file.  I will not duplicate all that fine information here.
  21.     This is $Revision: 1.10 $ of this file
  22.     It was last modified by $Author: death $ on $Date: 93/04/04 23:29:42 $
  23. Note that this file was created while using the New Century Schoolbook Roman typeface.  You may find that some things line up strangely if you don't use that family.
  24. $Log:    PICTFile.h,v $
  25.  * Revision 1.10  93/04/04  23:29:42  death
  26.  * Sun Apr  4 23:29:42 PDT 1993
  27.  * 
  28.  * Revision 1.9  93/01/09  21:07:02  death
  29.  * Sat Jan  9 21:07:02 PST 1993
  30.  * 
  31.  * Revision 1.8  93/01/01  11:51:11  death
  32.  * Fri Jan  1 11:51:11 PST 1993
  33.  * 
  34.  * Revision 1.7  92/12/31  15:34:00  death
  35.  * Thu Dec 31 15:34:00 PST 1992
  36.  * 
  37.  * Revision 1.6  92/12/05  23:06:51  death
  38.  * Sat Dec  5 23:06:51 PST 1992
  39.  * 
  40.  * Revision 1.5  92/12/03  18:01:08  death
  41.  * Thu Dec  3 18:01:07 PST 1992
  42.  * 
  43.  * Revision 1.4  92/11/27  19:37:22  death
  44.  * Fri Nov 27 19:37:22 PST 1992
  45.  * 
  46.  * Revision 1.3  92/11/08  09:26:13  death
  47.  * Sun Nov  8 09:26:13 PST 1992
  48.  * 
  49.  * Revision 1.2  92/08/09  19:46:17  death
  50.  * Sun Aug  9 19:46:17 PDT 1992
  51.  * 
  52.  * Revision 1.1  92/08/09  08:52:58  death
  53.  * Sun Aug  9 08:52:58 PDT 1992
  54.  * 
  55.   
  56.  ====================================================================
  57.  */
  58.  
  59.  
  60. #import "File.h"        // Parent class
  61. #import "common.h"    // my standard data types etc.
  62.  
  63. /////
  64. //    Define some data types used and returned by this class.  All correspond to various
  65. //    Mac PICT data types.
  66. /////
  67.  
  68. //
  69. //    93.08.16    djb    added INTEGER and LONGINT type...
  70. //
  71. typedef    Signed16Bits    INTEGER;
  72. typedef    Signed32Bits    LONGINT;
  73. typedef    Signed32Bits    FIXED;    // This is not an accurate remapping of the Mac FIXED type.
  74.  
  75. //
  76. //    Define the standard Pict rectangle
  77. //
  78. typedef struct {
  79.     INTEGER        top, left, bottom, right;    
  80. }    PICTRect;
  81.  
  82.  
  83. //
  84. //    Define the standard Pict point
  85. //
  86. typedef struct {
  87.     INTEGER        y, x;
  88. }    PICTPoint;
  89.  
  90. //
  91. //    Opcodes just get returned as one type, regardless of what source version
  92. //
  93. typedef    bits16    PICTOpcode;
  94.  
  95. //
  96. //    PicComment related structures.
  97. //
  98.  
  99. //
  100. //    WARNING: TPolyVerbRec may have its bitfields entirely reversed.
  101. //
  102. typedef   struct  TPolyVerbRec
  103. {
  104.     #ifdef __BIG_ENDIAN__
  105.     Byte    f7:1,    // reserved
  106.             f6:1,
  107.             f5:1,
  108.             f4:1,
  109.             f3:1,    
  110.             fPolyClose:1,        // TRUE = smoothing across endpoint.
  111.             fPolyFill:1,        // TRUE = Polygon should be filled. 
  112.             fPolyFrame:1;    // TRUE = Polygon should be framed. 
  113.     #elif __LITTLE_ENDIAN__
  114.     Byte    
  115.             fPolyFrame:1,        // TRUE = Polygon should be framed. 
  116.             fPolyFill:1,        // TRUE = Polygon should be filled. 
  117.             fPolyClose:1,        // TRUE = smoothing across endpoint.
  118.             f3:1,    // reserved    
  119.             f4:1,
  120.             f5:1,
  121.             f6:1,
  122.             f7:1;
  123.     #else
  124.         WARNING: this TPolyVerbRec isn't defined properly for your machine!
  125.     #endif
  126. }
  127. TPolyVerbRec;
  128.  
  129. //
  130. //    Constants for the TTxtPicRec  struct for a piccomment
  131. //    I'm not wanting an enum because then I'll want to use it in the struct, and so I'll
  132. //    have to figure out how to force it to be 8 bits long exactly.  (foolish)
  133. //
  134. // values for the tJus field of the record TTxtPicRec
  135.  #define    tJusNone 0
  136. #define    tJusLeft 1
  137. #define    tJusCenter 2
  138. #define    tJusRight 3
  139. #define    tJusFull 4
  140.  
  141. // values for the tFlip field of the TTxtPicRec record
  142. #define    tFlipNone 0
  143. #define    tFlipHorizontal 1
  144. #define    tFlipVertical 2
  145.  
  146.  
  147. @interface PICTFile:File
  148. {
  149.     ByteString        PICTHeader;
  150.     PICTRect*        BoundingRect;
  151.     Integer            PICTVersion;
  152.     Boolean            FoundEnd;
  153. }
  154.     
  155. -free;
  156.  
  157. - initAndUse:(ConstCString) pathname;
  158. - initAndUseTemporary;
  159. - OpenWithAccess: (Integer) operation;
  160.  
  161. - (Integer) GetVersion;
  162. - (ConstByteString) GetHeader;
  163. - (PICTRect*) GetBounds;
  164. - (PICTOpcode) GetOpcode;
  165. - (PICTRect*) GetRect;
  166. - (PICTPoint*) GetPoint;
  167. - (Byte) GetByte;
  168. - (SignedByte) GetSignedByte;
  169. - (CString) GetPString;
  170. - (Integer) GetINTEGER;
  171. - (PositiveInteger) GetPositiveINTEGER;
  172. - (Integer) GetLONGINT;
  173. - (PositiveInteger) GetPositiveLONGINT;
  174. - (Real) GetFixedNumber;
  175. - (TPolyVerbRec) GetPolyVerbs;
  176.  
  177. @end
  178.  
  179.  
  180. //
  181. //    Error codes  (using -400 to -300)
  182. //
  183. #define    ERR_MAYNOTWRITE        -420
  184. #define    ERR_UNKNOWNVERSION    -421
  185.